package com.leetcode_Onequestion;

public class leetcode_806 {
    public static void main(String[] args) {

    }
    /*
    * 2022/4/12
    * */

    public static int[] numberOfLines(int[] widths, String s){
        int line = 1;
        int num = 0;
        for (int i = 0; i < s.length(); i++) {
            num += widths[s.charAt(i) -'a'];
            if (num > 100){
                line++;
                num = widths[s.charAt(i) - 'a'];
            }
        }
        return new int[]{line,num};
    }
}
